<?php
$modules_includes = array ();
$modules_dirs = scandir ( MODULES_PATH );

foreach ( $modules_dirs as $module ) {
	if ($module [0] == ".") {
		continue;
	}
	$modules [] = $module;
	$modules_includes [] = "application.modules.{$module}.*";
	$modules_includes [] = "application.modules.{$module}.models.*";
	$modules_includes [] = "application.modules.{$module}.portlets.*";
	$modules_includes [] = "application.modules.{$module}.forms.*";
	$modules_includes [] = "application.modules.{$module}.components.*";
	$modules_includes [] = "application.modules.{$module}.components.zii.*";
}

$modules ['gii'] = array(
		'generatorPaths'=>array(
				'bootstrap.gii',
		),
		'class'=>'system.gii.GiiModule',
		'password'=>'yii',
		// If removed, Gii defaults to localhost only. Edit carefully to taste.
		'ipFilters'=>array('127.0.0.1','::1'),
);

$modules['user'] = array(
				'debug' => false,
				'userTable' => 'baby_user',
				'translationTable' => 'baby_translation',
);
$modules['usergroup'] = array(
		'usergroupTable' => 'baby_usergroup',
		'usergroupMessageTable' => 'baby_user_group_message',
);
$modules['membership'] = array(
		'membershipTable' => 'baby_membership',
		'paymentTable' => 'baby_payment',
);
$modules['friendship'] = array(
		'friendshipTable' => 'baby_friendship',
);
$modules['profile'] = array(
		'privacySettingTable' => 'baby_privacysetting',
		'profileFieldTable' => 'baby_profile_field',
		'profileTable' => 'baby_profile',
		'profileCommentTable' => 'baby_profile_comment',
		'profileVisitTable' => 'baby_profile_visit',
);
$modules['role'] = array(
		'roleTable' => 'baby_role',
		'userRoleTable' => 'baby_user_role',
		'actionTable' => 'baby_action',
		'permissionTable' => 'baby_permission',
);
$modules['message'] = array(
		'messageTable' => 'baby_message',
);


$comments = array(
		'comments'=>array(
			//you may override default config for all connecting models
			'defaultModelConfig' => array(
					//only registered users can post comments
					'registeredOnly' => false,
					'useCaptcha' => false,
					//allow comment tree
					'allowSubcommenting' => true,
					//display comments after moderation
					'premoderate' => false,
					//action for postig comment
					'postCommentAction' => 'comments/comment/postComment',
					//super user condition(display comment list in admin view and automoderate comments)
					'isSuperuser'=>'Yii::app()->user->checkAccess("moderate")',
					//order direction for comments
					'orderComments'=>'DESC',
			),
			//the models for commenting
			'commentableModels'=>array(
					//model with individual settings
					'Citys'=>array(
							'registeredOnly'=>true,
							'useCaptcha'=>true,
							'allowSubcommenting'=>false,
							//config for create link to view model page(page with comments)
							'pageUrl'=>array(
									'route'=>'admin/citys/view',
									'data'=>array('id'=>'city_id'),
							),
					),
					//model with default settings
					'ImpressionSet',
			),
			//config for user models, which is used in application
			'userConfig'=>array(
					'class'=>'YUMUser',
					'nameProperty'=>'username',
			)
		)
);


$modules = CMap::mergeArray($modules,$comments);
$components = require 'components.php';

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');


// CWebApplication properties can be configured here.
return array(
		'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
		'name'=>'白鹿说',
		'timeZone'=>'Asia/Shanghai', //设置时区为上海
		'language'=>'zh_cn',
		'layout'=>'metro',

		'defaultController'=>'home/home/index',

		// preloading 'log' component
		'preload'=>array('log'),

		// autoloading model and component classes
		'import'=>array_merge($modules_includes,array(
				'application.models.*',
				'application.components.*',
				'application.components.Helper.*',
				'application.components.System.*',
		)),
		'aliases'=>array(
				'ext'=>'application.extensions',
				'components'=>'application.components', // 设置元件目录
				'views'=>'application.views',           // 设置显示目录
				'widget'=>'application.widgets',
				'xupload'=>'ext.xupload',
				'widgets'=>'application.widgets'),      // 设置小工具目录
		'modules'=>$modules,
		// application components
		'components'=>$components,

		// application-level parameters that can be accessed
		// using Yii::app()->params['paramName']
		'params'=>array(
				'bbs'=>'http://bbs.bailushuo.com',
				// this is used in contact page
				'adminEmail'=>'shenhongmings@gmail.com',
				'imgPath'=>'/v/',
				'access_static_img'=>'/static_img/',
				'uploadPath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'../../upload/',
				'fileAccessPath'=>'/v/',
				'static_img'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'../../static_img/',
				'audioUploadPath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'../../audio/',
				'audioAccessPath'=>'/audio/',
				'imgUploadPath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'../../img/',
				'imgAccessPath'=>'/img/',
				'attachmentUploadPath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'../../attachment/',
		),
);